-
Notifications
You must be signed in to change notification settings - Fork 277
[smt_convt] Fix usage of use_array_of_bool
#6004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[smt_convt] Fix usage of use_array_of_bool
#6004
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #6004 +/- ##
===========================================
+ Coverage 74.11% 74.24% +0.13%
===========================================
Files 1444 1444
Lines 157389 157415 +26
===========================================
+ Hits 116646 116871 +225
+ Misses 40743 40544 -199
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me, but would you have any tests that newly pass with this fix?
Thanks for taking a look, Michael. The options I wanted to include the test case from #6005, basically use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to what @tautschnig says, test please!
Thanks for the review, @martin-cs. I am not sure how I could add a test for these changes ... Any ideas? cc: @tautschnig @kroening. Some background on why I made this PR and how I tested it:
So there is some performance issue in Z3 that is triggered by |
600ee90
to
f31a8c6
Compare
After an offline discussion with @tautschnig, I have added a regression test to check the raw SMT2 output instead of running end-to-end against an SMT solver. Please take a look and see if it looks okay. |
d2428d8
to
03248be
Compare
bool y[8]; | ||
bool *z = malloc(8 * sizeof(bool)); | ||
|
||
memset(y, 0, sizeof(y)); | ||
memset(z, 0, sizeof(8 * sizeof(bool))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't
bool y[8] = { 0 };
bool *z = calloc(8, sizeof(boo));
also do the trick, or does this not trigger the desired code paths? Likewise, is it actually necessary to use bool
, or could _Bool
or int
equally be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only __CPROVER_bool
seems to trigger the desired code paths.
I have these bool
variables (which are actually encoded as int
) just to make sure their encoding is unaffected by the proposed changes.
I am not sure what _Bool
is -- I will try this out and also modify the array initializations as you suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like _Bool
doesn't trigger the code path either.
I have now implemented the changes as suggested.
28504a7
to
15e40f9
Compare
Several SMT translation routines were not respecting `use_array_of_bool` or led to a buggy SMT translation when they used it. This change ensures consistent usage of this option across all array-related translation routines.
15e40f9
to
3e27734
Compare
Several SMT translation routines were not respecting
use_array_of_bool
, or led to a buggy SMT translation when they used it.This change ensures consistent usage of this option across all array-related translation routines.
Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/My commit message includes data points confirming performance improvements (if claimed).White-space or formatting changes outside the feature-related changed lines are in commits of their own.